home *** CD-ROM | disk | FTP | other *** search
- import java.awt.*;
-
- import symantec.itools.awt.util.dialog.ModalDialog;
-
- public class PasswordDialog extends ModalDialog
- {
- public PasswordDialog(Frame parent, String title)
- {
- super(parent, title);
-
- // This code is automatically generated by Visual Cafe when you add
- // components to the visual environment. It instantiates and initializes
- // the components. To modify the code, only use code syntax that matches
- // what Visual Cafe can generate, or Visual Cafe may be unable to back
- // parse your Java file into its visual environment.
- //{{INIT_CONTROLS
- setLayout(null);
- setSize(215,130);
- setVisible(false);
- nameLabel.setText("Name:");
- add(nameLabel);
- nameLabel.setBounds(10,32,75,15);
- passwordLabel.setText("Password:");
- add(passwordLabel);
- passwordLabel.setBounds(10,60,75,15);
- add(userTextField);
- userTextField.setBounds(85,28,100,22);
- passTextField.setEchoChar('*');
- add(passTextField);
- passTextField.setBounds(85,57,100,22);
- okButton.setLabel("OK");
- add(okButton);
- okButton.setBackground(java.awt.Color.lightGray);
- okButton.setBounds(80,95,20,40);
- //}}
-
- //{{REGISTER_LISTENERS
- //}}
- }
-
- public PasswordDialog(Frame parent)
- {
- this(parent, "Username/Password");
- }
-
- // Add a constructor for Interactions (ignoring modal)
- public PasswordDialog(Frame parent, boolean modal)
- {
- this(parent);
- }
-
- // Add a constructor for Interactions (ignoring modal)
- public PasswordDialog(Frame parent, String title, boolean modal)
- {
- this(parent, title);
- }
-
- public String getUserName()
- {
- return userTextField.getText();
- }
-
- public String getPassword()
- {
- return passTextField.getText();
- }
-
- public void setUserName(String name)
- {
- userTextField.setText(name);
- }
-
- public void setPassword(String pass)
- {
- passTextField.setText(pass);
- }
-
- public void addNotify()
- {
- // Record the size of the window prior to calling parents addNotify.
- Dimension d = getSize();
-
- super.addNotify();
-
- if (fComponentsAdjusted)
- return;
-
- // Adjust components according to the insets
- Insets insets = getInsets();
- setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height);
- Component components[] = getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Point p = components[i].getLocation();
- p.translate(insets.left, insets.top);
- components[i].setLocation(p);
- }
- fComponentsAdjusted = true;
- }
-
- // Used for addNotify check.
- boolean fComponentsAdjusted = false;
-
- //{{DECLARE_CONTROLS
- java.awt.Label nameLabel = new java.awt.Label();
- java.awt.Label passwordLabel = new java.awt.Label();
- java.awt.TextField userTextField = new java.awt.TextField();
- java.awt.TextField passTextField = new java.awt.TextField();
- java.awt.Button okButton = new java.awt.Button();
- //}}
- }
-